#pragma once
#ifdef WIN32
#include <Windows.h>
#else
#pragma GCC diagnostic ignored "-Wwrite-strings"
#endif
#include "CC_Typedef.h"

template <typename T>
class TSingleton
{
public:
	static T *GetInstance()
	{
		if (!m_Instance)
			m_Instance = new T();
		return m_Instance;
	}

	static void Destory()
	{
		CC_SAFE_DELETE(m_Instance);
	}

protected:
	TSingleton(){}
	TSingleton(const TSingleton<T>&){}
	TSingleton<T>& operator=(const TSingleton<T>&){}

	static T *m_Instance;
};

template<typename T>
T *TSingleton<T>::m_Instance = 0;